package com.usian.admin.controller;

import com.usian.admin.service.UserLoginService;
import com.usian.apis.admin.LoginControllerApi;
import com.usian.model.admin.dtos.AdUserDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/login")
@PropertySource(value = "classpath:demo.properties")
public class LoginController implements LoginControllerApi {

    @Autowired
    private UserLoginService userLoginService;

    @Override
    @PostMapping("/in")
    public ResponseResult login(@RequestBody AdUserDto dto) {
        return userLoginService.login(dto);
    }

//    public static void main(String[] args) {
//        String salt = "123456";
//        String pswd = "1"+salt;
//
//        String saltPswd = DigestUtils.md5DigestAsHex(pswd.getBytes());
//        System.out.println(saltPswd);
//        加密后的密码：eeafb716f93fa090d7716749a6eefa72
//    }




}